﻿using System;
using BaMusaSoft.RPS.DataModel.Repositories;

namespace BaMusaSoft.RPS.DataModel
{
    /// <summary>
    /// Represents unit of business transactions grouped together
    /// </summary>
    public interface IUnitOfWork : IDisposable
    {
        /// <summary>
        /// Gets the claims.
        /// </summary>
        RepositoryBase<Claim> Claims { get; }

        /// <summary>
        /// Gets the claim details.
        /// </summary>
        RepositoryBase<ClaimDetail> ClaimDetails { get; }

        /// <summary>
        /// Gets the claim numbers.
        /// </summary>
        RepositoryBase<ClaimNumber> ClaimNumbers { get; }

        /// <summary>
        /// Gets the contracts.
        /// </summary>
        RepositoryBase<Contract> Contracts { get; }

        /// <summary>
        /// Gets the contract activities.
        /// </summary>
        RepositoryBase<ContractActivity> ContractActivities { get; }

        /// <summary>
        /// Gets the customers.
        /// </summary>
        RepositoryBase<Customer> Customers { get; }

        /// <summary>
        /// Gets the outboxes.
        /// </summary>
        RepositoryBase<Outbox> Outboxes { get; }

        /// <summary>
        /// Gets the payments.
        /// </summary>
        RepositoryBase<Payment> Payments { get; }

        /// <summary>
        /// Gets the payment types.
        /// </summary>
        RepositoryBase<PaymentType> PaymentTypes { get; }

        /// <summary>
        /// Gets the properties.
        /// </summary>
        RepositoryBase<Property> Properties { get; }

        /// <summary>
        /// Gets the schedule details.
        /// </summary>
        RepositoryBase<ScheduleDetail> ScheduleDetails { get; }

        /// <summary>
        /// Gets the schedules.
        /// </summary>
        RepositoryBase<Schedule> Schedules { get; }

        /// <summary>
        /// Gets the schedule payments.
        /// </summary>
        RepositoryBase<SchedulePayment> SchedulePayments { get; }

        /// <summary>
        /// Gets the signers.
        /// </summary>
        RepositoryBase<Signer> Signers { get; }

        /// <summary>
        /// Gets a value indicating whether this unit of work has changes.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance has changes; otherwise, <c>false</c>.
        /// </value>
        bool HasChanges { get; }

        /// <summary>
        /// Saves all changes made to current unit of work.
        /// </summary>
        void Save();

        /// <summary>
        /// Occurs when [state changed].
        /// </summary>
        event EventHandler StateChanged;

        /// <summary>
        /// Resets current unit of work. This will discard all changes made since last call to Save method.
        /// </summary>
        void Reset();
    }
}